#ifndef CALENDAR_H
#define CALENDAR_H
//  File:	 Calendar.h
//  Author:       Scott Nordmann & Lauren Wallace
//  Description:  A class definition for the Calendar.
#include "Tag.h"
#include <fstream>
#include <string>
#include <vector>

class Date;
class Event;

class Calendar
{
public:
	Calendar();
	Calendar(std::ifstream& ifload);
	~Calendar();

	void shutDown(std::ofstream& ofsave);

	void display();

	// gets the Date with the given year, month, and date
	// not const because the Date will be created if it does not exist
	Date* getDate(int y, int m, int d);
	Date* getDate(Date d);

	void createEvent(const std::string& creator);
	void editEvent();
	void deleteEvent();
	bool tagEvent(Tag& currentTag);
	bool tagEvent(Tag& currentTag, const std::string& dateString, const std::string& eventName);

	// used to interact with the Inbox
	Event* createMail(const std::string& creator);
	void createEvent(Event* e);

	bool isEmpty();

private:
	void displayWeek(std::vector<Date*>::const_iterator startDate);
	std::vector<Date*>::iterator findDate(Date d);
	std::vector<Date*>::iterator getDatePos(Date d);
	std::vector<Date*>::const_iterator Calendar::getNextDate(const Date& d);
	void sortDates();
	
	std::vector<Date*> dates;
};
inline bool Calendar::isEmpty()
{
	return dates.empty();
}
#endif
